<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="my" uri="http://www.trkj.com/tr1702/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>班组</title>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/locale/easyui-lang-zh_CN.js"/>"></script>
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/default/easyui.css"/>" />
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/icon.css"/>" />
</head>

<body>
	<script type="text/javascript">
		/*删除*/
		function delRolesh(TEAM_ID) {
			$.messager.confirm('确认', '您确定要删除吗？', function(v) {
				$.post("to_team_delede", {
					teamId:TEAM_ID
				}, function() {
					$('#shq_team_tb').datagrid('reload');
				});
			});
		}
		/* 状态 */
		var team_check= function(value,row,index){
			var pic="";	
			var state = row.TEAM_STATE;
			if(state==0){
				pic = "<input type='checkbox'>";
			}else if(state==1){
				pic="<input type='checkbox' checked>";
			}
			return pic;
		}
		/*操作图标*/
		var temFormatter = function(value, row, index) {
			var dels="";
			var wrongs = " <a btn='cell_btn_wrongs' onclick='wrongs("
					+ row.TEAM_ID + ","+row.teamState+")'></a>";
			var edits = " <a btn='cell_btn_edits' onclick='editRoles("
					+ row.TEAM_ID + ")'></a>";
			<my:g id="42">dels = " <a btn='cell_btn_dels' onclick='delRolesh("
					+ row.TEAM_ID + ")'></a>";</my:g>
			return wrongs + edits + dels;
		}
		/*  */
		/*禁用*/
	/* function wrongs(shiftId,shiftState){
		$('#dd_shift_update').dialog("close");
		var jy_state =1;
		alert(shiftState);
		if(shiftState==1){
			jy_state=0;
			$.messager.confirm('确认', '您确定要打开该规则吗？', function(v){
				if(v){
					$.post("update_tran_shift_state", {shiftId: shiftId,shiftState:jy_state}, function(v){
						if(v.success){
							$('#shq_team_tb').datagrid('reload');
						}else{
							$.messager.alert('错误', v.message);
						}
					});
				}else{
				}
			}); 
		}else if(shiftState==0){
			jy_state=1;
			$.messager.confirm('确认', '您确定要关闭该规则吗？', function(v){
				if(v){
					$.post("update_tran_shift_state", {shiftId: shiftId,shiftState:jy_state}, function(v){
						if(v.success){
							$('#shq_team_tb').datagrid('reload');
						}else{
							$.messager.alert('错误', v.message);
						}
					});
				}else{
					
				}
				
			}); 
		}
		
	}   */
		$(function() {
			//新增
			$(".addbtnteam").linkbutton({
				onClick : function() {
					$("#shq_team_div").panel({
						href : "to_core_teamadd"
					});
				}
			});
			<my:g id="174">
			//双击获取值
				$('#shq_team_tb').datagrid({
					onDblClickRow:function(index,row){
					var teamId=row.TEAM_ID;
					 $("#shq_team_div").panel({
						href : "to_team_updatefindall?teamId="+teamId
					}); 
				}
				});
			</my:g>
			/* 操作图*/
			$("#shq_team_tb").datagrid({
				onLoadSuccess : function() {
					$("a[btn=cell_btn_dels]").linkbutton({
						iconCls : 'icon-cancel',
						plain : true
					});
					/* $("a[btn=cell_btn_wrongs]").linkbutton({
						iconCls : 'icon-no_red',
						plain : true
					}); */
				}
			});
		});
	</script>
	<div id="shq_team_div" class="easyui-panel"
		data-options="fit:true,border:false">
	<table class="easyui-datagrid" id="shq_team_tb"
		style="width: 100%"
		data-options="
				fitColumns:true,
				fit:true,
				pagination:true,     
				pageSize:5,    
				pageList: [5,10,30,40,50], 
				url:'to_findall_team',
				rownumbers:true,
				Striped:true, 
				singleSelect:true,
				striped:true,
				toolbar:'#toolte'
        ">
		<thead>
			<tr>
				<th data-options="field:'TEAM_ID',width:40,align:'center'">编号</th>
				<th data-options="field:'TEAM_NAME',width:50,align:'center'">名称</th>
				<th data-options="field:'DEFIDE_NAME',width:100,align:'center'
					">部门</th>
				<th data-options="field:'TEAM_CONTAIN',width:40,align:'center'">包含人数</th>
				<th data-options="field:'TEAM_REMARKS',width:150,align:'center'">备注</th>
				<th data-options="field:'TEAM_PERSON',width:100,align:'center'">创建者</th>
				<th
					data-options="field:'TEAM_TAKEEFFECT',width:100,align:'center',formatter:function(value,row,index){
					if(value!=null){
						var date = new Date(value);
						return date.toLocaleString();
					}
						return;
				}">生效时日</th>
				<th
					data-options="field:'TEAM_LNVALID',width:100,align:'center',formatter:function(value,row,index){
					if(value!=null){
						var date = new Date(value);
						return date.toLocaleString();
					}
						return;
				}">失效时日</th>
				<th
					data-options="field:'TEAM_FOUNDDATE',width:100,align:'center',formatter:function(value,row,index){
					if(value!=null){
						var date = new Date(value);
						return date.toLocaleString();
					}
						return;
				}">创建时间</th>
				<th
					data-options="field:'TEAM_UPDATE',width:100,align:'center',formatter:function(value,row,index){
					if(value!=null){
						var date = new Date(value);
						return date.toLocaleString();
					}
						return;
				}">更新时间</th>
				<!-- <th data-options="field:'TEAM_STATE',width:30,align:'center',formatter:team_check">
					状态
				</th> -->
				<th
					data-options="field:'m',width:40,align:'center',formatter:temFormatter">操作</th>
			</tr>
		</thead>
		<tbody>

		</tbody>
	</table>
	<!--工具-->
	<div id="toolte" style="padding-left: 30px;">
		<my:g id="41"><a class="easyui-linkbutton addbtnteam"
			data-options="iconCls:'icon-add'">新增</a> </my:g>
			<input class="easyui-searchbox" data-options="label:'搜索文本', width:200,labelWidth:70,       
			 	searcher:function(value,name){
      			 $('#shq_team_tb').datagrid('load','to_findall_teambyname?key='+value);      
			 }"/> 
	</div>
	</div>
</body>
</html>